import { axios } from '@/utils/request'

const api = {
  getOrderList: '/order/list',
  handleOrderCancel: 'order/apply-order-delete',
  handleOrderSend: '/order/send',
  handleOrderConfirm: '/order/confirm',
  handleOrderPrint: '/order/print-order',
  handleOrderClerk: '/order/clerk',
  setSellerComments: '/order/seller-comments',
  setOrderAddress: '/order/set-order-address',
  getRefundList: '/order/refund',
  orderRefund: '/order/refund-handle',
  commentList: '/order/comment-list',
  commentReply: '/order/comment-reply',
  commentHide: '/order/comment-hide',
  commentDelete: '/order/comment-delete',
  addComment: '/order/comment-edit',
  setPrice: '/order/modify-price',
  table: '/order/table',
  edit: '/order/edit',
  print: '/order/print',
  expressDetail: '/order/express-detail',
  updateShop: '/order/update-shop',
  setWords: '/order/set-words',
  // 转单平台
  transOrder: 'md/trans-order',
  // 核销订单
  clerkOrder: '/order/clerk',
  // 物流信息
  getExpressData: '/order/get-express-data',
}

export default api

export function transOrder(parameter) {
  return axios({
    url: api.transOrder,
    method: 'post',
    data: parameter,
  })
}

export function getOrderList(parameter) {
  return axios({
    url: api.getOrderList,
    method: 'get',
    params: parameter,
  })
}

export function expgetOrderList(parameter) {
  return axios({
    url: api.getOrderList,
    method: 'get',
    params: parameter,
    responseType: 'blob',
  })
}

export function orderCancel(parameter) {
  return axios({
    url: api.handleOrderCancel,
    method: 'post',
    data: parameter,
  })
}

export function orderSend(parameter) {
  return axios({
    url: api.handleOrderSend,
    method: 'post',
    data: parameter,
  })
}

export function orderConfirm(parameter) {
  return axios({
    url: api.handleOrderConfirm,
    method: 'post',
    data: parameter,
  })
}

export function orderPrint(parameter) {
  return axios({
    url: api.handleOrderPrint,
    method: 'post',
    data: parameter,
  })
}

export function orderClerk(parameter) {
  return axios({
    url: api.handleOrderClerk,
    method: 'post',
    data: parameter,
  })
}

export function setComments(parameter) {
  return axios({
    url: api.setSellerComments,
    method: 'get',
    params: parameter,
  })
}

export function setAddress(parameter) {
  return axios({
    url: api.setOrderAddress,
    method: 'post',
    data: parameter,
  })
}

export function refundList(parameter) {
  return axios({
    url: api.getRefundList,
    method: 'get',
    params: parameter,
  })
}

export function exprefundList(parameter) {
  return axios({
    url: api.getRefundList,
    method: 'get',
    params: parameter,
    responseType: 'blob',
  })
}

export function refundOrder(parameter) {
  return axios({
    url: api.orderRefund,
    method: 'post',
    data: parameter,
  })
}

export function getComment(parameter) {
  return axios({
    url: api.commentList,
    method: 'get',
    params: parameter,
  })
}

export function handleCommentReply(parameter) {
  return axios({
    url: api.commentReply,
    method: 'post',
    data: parameter,
  })
}

export function handleCommentHide(parameter) {
  return axios({
    url: api.commentHide,
    method: 'post',
    data: parameter,
  })
}

export function handleCommentDelete(parameter) {
  return axios({
    url: api.commentDelete,
    method: 'post',
    data: parameter,
  })
}

export function handleEditComment(parameter) {
  return axios({
    url: api.addComment,
    method: 'post',
    data: parameter,
  })
}

export function setWords(parameter) {
  return axios({
    url: api.setWords,
    method: 'post',
    data: parameter,
  })
}

export function modifyPrice(parameter) {
  return axios({
    url: api.setPrice,
    method: 'post',
    data: parameter,
  })
}

export function orderTable(parameter) {
  return axios({
    url: api.table,
    method: 'get',
    params: parameter,
  })
}

export function orderEdit(parameter) {
  return axios({
    url: api.edit,
    method: 'get',
    params: parameter,
  })
}

// 电子面单打印
export function orderPrintMd(parameter) {
  return axios({
    url: api.print,
    method: 'get',
    params: parameter,
  })
}

// 订单物流查询
export function orderExpress(parameter) {
  return axios({
    url: api.expressDetail,
    method: 'get',
    params: parameter,
  })
}

// 切换社区
export function UpdateShop(parameter) {
  return axios({
    url: api.updateShop,
    method: 'get',
    params: parameter,
  })
}

// 核销订单

export function clerkOrder(parameter) {
  return axios({
    url: api.clerkOrder,
    method: 'post',
    data: parameter,
  })
}

export function getExpressData(data) {
  return axios({
    url: api.getExpressData,
    method: 'post',
    data,
  })
}

export function refundMoney(data) {
  return axios({
    url: '/order/refund-money',
    method: 'post',
    data,
  })
}


export function setExpressNo(data) {
  return axios({
    url: '/order/set-express-no',
    method: 'post',
    data,
  })
}
